import {url,axios} from '.';

export const getContents = async (params) => {
    let res = await axios({
        method: 'get',
        url: `${url}/contents`,
        params
    });
    return res.data;

}
export const getContentsByTypeId = async (params) => {
    let res = await axios({
        method: 'get',
        url: `${url}/contents/type`,
        params
    });
    return res.data;

}
export const getContentById = async (id) => {
    let res = await axios({
        method: 'get',
        url: `${url}/contents/${id}`
    });
    return res.data;
}
export const addContent = async (data) => {
    let res = await axios({
        method: 'post',
        url: `${url}/contents`,
        data
    });
    return res.data;

}
export const updateContent = async (data) => {
    let res = await axios({
        method: 'put',
        url: `${url}/contents/${data.id}`,
        data
    });
    return res.data;

}

export const updateContentStatus = async (id,status) => {
    let res = await axios({
        method: 'put',
        url: `${url}/contents/${id}`,
        data:{
            "statusId":status
        }
    });
    return res.data;
}
export const updateContentIndex = async (id,val) => {
    let res = await axios({
        method: 'put',
        url: `${url}/contents/index/${id}`,
        data:{
            val
        }
    });
    return res.data;
}
export const deleteContent = async (id) => {
    let res = await axios({
        method: 'delete',
        url: `${url}/contents/${id}`
    });
    return res.data;
}


